package com.exam.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.exam.system.entity.SysUser;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author LY
 * @create 2023/10/8 14:08
 * @Description 用户mapper
 */
public interface SysUserMapper extends BaseMapper<SysUser> {

    @Select("select * from sys_user where username = #{username}")
    SysUser findSysUser(@Param("username") String username);

    @Select("select per.permsKey from sys_user su " +
            "join sys_user_perms sup on sup.userId = su.id " +
            "join sys_permission per on sup.permsId = per.id " +
            "where su.username = #{username}")
    List<String> getSysUserPerms(@Param("username") String username);
}
